#import <Foundation/Foundation.h>
#import "YLWebImageCompat.h"
#import "NSData+YLImageContentType.h"

FOUNDATION_EXPORT NSString * _Nonnull const YLWebImageCoderScaleDownLargeImagesKey;

CG_EXTERN CGColorSpaceRef _Nonnull YLCGColorSpaceGetDeviceRGB(void);

CG_EXTERN BOOL YLCGImageRefContainsAlpha(_Nullable CGImageRef imageRef);


@protocol YLWebImageCoder <NSObject>

@required
#pragma mark - Decoding

- (BOOL)canDecodeFromData:(nullable NSData *)data;

- (nullable UIImage *)decodedImageWithData:(nullable NSData *)data;

- (nullable UIImage *)decompressedImageWithImage:(nullable UIImage *)image
                                            data:(NSData * _Nullable * _Nonnull)data
                                         options:(nullable NSDictionary<NSString*, NSObject*>*)optionsDict;

#pragma mark - Encoding

- (BOOL)canEncodeToFormat:(YLImageFormat)format;

- (nullable NSData *)encodedDataWithImage:(nullable UIImage *)image format:(YLImageFormat)format;

@end

@protocol YLWebImageProgressiveCoder <YLWebImageCoder>

@required

- (BOOL)canIncrementallyDecodeFromData:(nullable NSData *)data;

- (nullable UIImage *)incrementallyDecodedImageWithData:(nullable NSData *)data finished:(BOOL)finished;

@end
